package cn.com.pc.content.domain.content;

import cn.com.pc.content.domain.audit.AuditStatus;
import cn.com.pc.content.domain.Biz;
import cn.com.pc.content.domain.Site;
import cn.com.pc.content.domain.view.ContentView;
import cn.com.pc.content.mongo.CustomMongoRepository;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Repository;

import java.util.List;

//@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE, proxyMode = ScopedProxyMode.INTERFACES)
@Repository
public interface ContentRepository extends CustomMongoRepository<Content, String> {

    Content findByIdAndAuditStatusNot(String id, AuditStatus auditStatus);

    Content findByReferIdAndSiteAndBiz(String referId, Site site, Biz biz);

    Page<ContentView> findAllByReferIdInAndSiteAndBizAndAuditStatusNot(List<String> referIds, Site site, Biz biz, AuditStatus auditStatus, Pageable pageable);

    Page<ContentView> findAllByIdInAndAuditStatusNot(List<String> ids, AuditStatus auditStatus, Pageable pageable);
}
